var common = {
    dateFormat:function(time,s) {
        var date = null
        if (time) {
            date = new Date(time*1000)
        } else {
            date = new Date()
        }
        var y = date.getFullYear()
        var m = this.mendZero(date.getMonth() + 1)
        var d = this.mendZero(date.getDate())
        var h = this.mendZero(date.getHours())
        var min = this.mendZero(date.getMinutes())
        if (s !=1) {
            return y +'-'+ m +'-' + d +' ' + h + ':' + min
        } else {
            return y +'-'+ m +'-' + d
        }
       
    },
    mendZero:function(num) {
        var s = num
        if (num < 10) {
            s = '0'+ num
        }
        return s
    }

}
export default common